package com.rxt.controller;


import com.rxt.common.result.Result;
import com.rxt.model.domain.UExpert;
import com.rxt.model.vo.KKonwledgePageVo;
import com.rxt.model.vo.UExpertPageVo;
import com.rxt.service.IKRemarkService;
import com.rxt.service.IUExpertService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 周梓文
 * @since 2023-08-24
 */
@Api(tags = "专家模块")
@RestController
@RequestMapping("/uExpert")
public class UExpertController {

    @Autowired
    private IUExpertService expertService;

    @GetMapping
    //加上此注解代表要对此接口记录日志
    @ApiOperation("分页获取专家列表")
    public Result page(UExpertPageVo expertPage){

        return expertService.getPage(expertPage);
    }

    /**
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    @ApiOperation("根据id查询单个专家信息")
    public Result getOne(@PathVariable Long id){

        return expertService.getOneByID(id);
    }

    @DeleteMapping("/{id}")
    @ApiOperation("删除专家")
    public Result delete(@PathVariable Long id){

        return expertService.dedleteById(id);
    }

    @PostMapping
    @ApiOperation("修改专家信息")
    public Result update(@RequestBody UExpert expert){
        System.out.println(expert);
        return expertService.updateExpertById(expert);
    }

}

